package day26;

import java.io.IOException;
import java.net.*;
import java.util.Scanner;

public class Send {
    public static void main(String[] args) throws IOException {
        String chatStr="";
        while(!"886".equals(chatStr)) {
            Scanner sc = new Scanner(System.in);
            System.out.println("Enter your chat message: ");
            chatStr = sc.nextLine();
            DatagramSocket ds = new DatagramSocket();
            InetAddress address = InetAddress.getByName("127.0.0.1");
            DatagramPacket dp = new DatagramPacket(chatStr.getBytes(), chatStr.length(), address, 1024);
            ds.send(dp);
            ds.close();
        }
    }
}
